<%-- 
    Document   : list
    Created on : Nov 12, 2013, 12:02:03 AM
    Author     : Shin
--%>

<%@ page language="java" import="java.sql.*" %>
<% response.setContentType("text/html");%>
<%
    String str = request.getParameter("queryString");
    try {
        Class.forName("com.mysql.jdbc.Driver");
// Get a Connection to the database
        Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/hepo", "root", "pass");
//Add the data into the database
        String sql = "SELECT * FROM desa WHERE nama LIKE '" + str + "%' LIMIT 10";
        Statement stm = con.createStatement();
        stm.executeQuery(sql);
        ResultSet rs = stm.getResultSet();
        while (rs.next()) {
            out.println(" <li onclick=\"document.getElementById('inputString').value='" + rs.getString("nama") + "';\">" + rs.getString("nama") + "</li>");
            
        }
    } catch (Exception e) {
        out.println("Exception is ;" + e);
    }
%>
